package com.catchu.pattern.creational.适配器模式.基于类;

/**
 * 用户管理适配器
 */
public class UserManageAdapter extends UserOperation implements UserManageInterface {

    @Override
    public Integer addUser(String name) {
        if(super.getSnByName(name)>0){
            throw new RuntimeException("用户已存在，添加用户失败");
        }

        if(!super.insertUser(name)){
            throw new RuntimeException("添加用户失败");
        }

        return getSnByName(name);
    }
}
